import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;

import org.json.JSONArray;
import org.json.JSONObject;

import model.*;

import dao.*;



public class run {

	/**
	 * @param args
	 * @throws ClassNotFoundException 
	 * @throws SQLException 
	 * @throws ParseException 
	 */
	public static void main(String[] args) throws SQLException, ClassNotFoundException, ParseException {
		// TODO Auto-generated method stub
		ObjectDAO oDao = new ObjectDAO();
		EmployeeDAO emDao = new EmployeeDAO();
		ProfileDAO pDao = new ProfileDAO();
		FeedbackDAO fDao = new FeedbackDAO();
		
		Date d = new Date();
		System.out.println(d.toString());
		
		
		String string = "2013-2-4";
		Date date = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(string);
		
		
		String jsonString;
		
		JSONObject o = new JSONObject();
		
		for(int i =1; i <=2; i++) {
			JSONArray cellArray = new JSONArray();
			ArrayList<Section> list = oDao.getSectionByCategory(i);
			
			for(Section s: list) {
				int recNo = list.size();
				JSONObject cellObj = new JSONObject();
				cellObj.put("id", s.getSectionId());
				cellObj.put("name", s.getSectionName());
				cellArray.put(cellObj);
			}		
			o.put(Integer.toString(i),cellArray);
			
		}
		jsonString = o.toString();

		System.out.println(jsonString);
	}

}
